setwd("/home1/30/jc227089/Toad_point_process_model/DONE_NAT")

tt<-c(2000*100, 2000*1000, 2000*10000, 2000*100000)

script.file<-'/home1/30/jc227089/Toad_point_process_model/DONE_NAT/ppmodel(nat).R'

for (ii in 1:length(tt)) {
	##create the sh file
	zz = file(paste('jobrun_',ii,'.sh',sep=''),'w')
		cat('##################################\n',file=zz)
		cat('#!/bin/sh\n',file=zz)
		cat('cd $PBS_O_WORKDIR\n',file=zz)
		cat("R CMD BATCH '--args PseudoK=",tt[ii],"' ",script.file,' jobrun_',ii,'.Rout --no-save \n',sep='',file=zz)
		cat('##################################\n',file=zz)
	close(zz)
			
	#submit the job
	system(paste('qsub -m n -l nodes=1:ppn=2 jobrun_',ii,'.sh',sep=''))
}
